import Vue from "vue";
import VueRouter from "vue-router";
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

Vue.use(VueRouter);

const routes = [
    {
        path: "/login",
        name: "login",
        component: () => import(/* webpackChunkName: "login" */ "views/login/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/",
        redirect: "/home",
    },

    {
        path: "/home",
        name: "home",
        component: () => import(/* webpackChunkName: "home" */ "views/home/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {
            showFooter: true,
        },
    },
    {
        path: "/exam",
        name: "exam",
        component: () => import(/* webpackChunkName: "exam" */ "views/exam/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {
            showFooter: false,
        },
    },
    {
        path: "/exam-list",
        name: "exam-list",
        component: () => import(/* webpackChunkName: "exam-list" */ "views/exam-list/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {
            showFooter: true,
        },
    },

    {
        path: "/mine",
        name: "mine",
        component: () => import(/* webpackChunkName: "mine" */ "views/mine/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {
            showFooter: true,
        },
    },

    {
        path: "/train",
        name: "train",
        component: () => import(/* webpackChunkName: "train" */ "views/train/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/new-papers",
        name: "new-papers",
        component: () => import(/* webpackChunkName: "new-papers" */ "views/train/new-papers"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/edit-papers",
        name: "edit-papers",
        component: () => import(/* webpackChunkName: "edit-papers" */ "views/train/edit-papers"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/contrast",
        name: "contrast",
        component: () => import(/* webpackChunkName: "contrast" */ "views/contrast/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/exam-instruction",
        name: "exam-instruction",
        component: () =>
            import(/* webpackChunkName: "exam-instruction" */ "views/exam-instruction/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/score",
        name: "score",
        component: () => import(/* webpackChunkName: "score" */ "views/score/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/contrast-table",
        name: "contrast-table",
        component: () =>
            import(/* webpackChunkName: "contrast-table" */ "views/contrast-table/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/notice",
        name: "notice",
        component: () => import(/* webpackChunkName: "notice" */ "views/notice/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/exam-explain",
        name: "exam-explain",
        component: () => import(/* webpackChunkName: "exam-explain" */ "views/exam-explain/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
    {
        path: "/comparative",
        name: "comparative",
        component: () => import(/* webpackChunkName: "comparative" */ "views/comparative/index"),
        // 此时的Home等都是返回路由组件的函数，只有请求对应的路由路径时(第一次)才会执行此函数并加载路由组件
        // 标识此路由是否显示FooterGuide
        meta: {},
    },
];

const router = new VueRouter({
    routes,
});

export default router;
